/*
*
* NHoodInfoUI
*
* This class controls the neighbourhood informtion that updates with
* mouse position
*
*/
class NHoodInfoUI {
  
  // ------------------------------------------
  // attributes
  // ------------------------------------------
  ControlP5 controlp5;
  int origX, origY, wid, hei;
  Textlabel title, nameLabel, name, curValLabel, curVal, descLabel, desc;
  
  // ------------------------------------------
  // constructor
  // ------------------------------------------
  NHoodInfoUI(ControlP5 cp5, int x, int y, int w, int h) {
    
    // set attributes
    controlp5 = cp5;
    origX = x;
    origY = y;
    wid = w;
    hei = h;
    
    // create static textLabels
    title = controlp5.addTextlabel("title", "NEIGHBOURHOOD INFO", (origX + 4), (origY + 4));
    title.setColorValue(0);
    title.hide();
    nameLabel = controlp5.addTextlabel("nameLabel", "Name: ", (origX + 4), (origY + 16));
    nameLabel.setColorValue(0);
    nameLabel.hide();
    curValLabel = controlp5.addTextlabel("curValLabel", "Current metric value: ", (origX + 4), (origY + 28));
    curValLabel.setColorValue(0);
    curValLabel.hide();
    
    // create dynamic textLabels
    name = controlp5.addTextlabel("name", "", (origX + 34), (origY + 16));
    name.setColorValue(0);
    name.hide();
    curVal = controlp5.addTextlabel("curVal", "", (origX + 103), (origY + 28));
    curVal.setColorValue(0);
    curVal.hide();
    
  } // constructor
  
  // ------------------------------------------
  // drawStatic
  // draws components that aren't updated with mouse position
  // ------------------------------------------
  void drawStatic() {
    
    // draw labels
    title.show();
    nameLabel.show();
    curValLabel.show();
    
    // draw "frame" rectangle;
    noStroke();
    fill(50, 50);
    rect(origX, origY, wid, hei);
    
  } // drawStatic
  
  // -------------------------------------------
  // drawDynamic
  // draws components that are updated with mouse position
  // -------------------------------------------
  void drawDynamic(String sName, String sCurVal) {
    
    name.setValue(sName);
    name.show();
    curVal.setValue(sCurVal);
    curVal.show();
    
  } // drawDynamic
  
  void hideDynamic() {
    name.hide();
    curVal.hide();
  }
  
  
} // NHoodInfoUI
